{extend name="shop/showstore/common/store_layout" /}
{block name="content"}

<div class="wrapper mt10">
  <div class="ncs-main-container">
    <div class="title">
      <h4><?php if(!empty(I('param.stc_id'))){echo $stc_name;}elseif(!empty(I('param.inkeyword'))){echo '含有“'.I('param.inkeyword').'”的商品';}else{ echo '全部商品'; }?> </h4>
    </div>
    <div class="ncs-goodslist-bar">
      <ul class="ncs-array">
        <li class='<?php echo I('param.key') == '1'?'selected':'';?>'><a <?php if(I('param.key') == '1'){?>class="<?php echo I('param.order') == 1 ? 'asc' : 'desc';?>"<?php }?> href="<?php echo (I('param.key') == '1' && I('param.order') == '2') ? replaceParam(array('key' => '1', 'order'=>'1')) : replaceParam(array('key' => '1', 'order' => '2'));?>">新品</a></li>
        <li class='<?php echo I('param.key') == '2'?'selected':'';?>'><a <?php if(I('param.key') == '2'){?>class="<?php echo I('param.order') == 1 ? 'asc' : 'desc';?>"<?php }?> href="<?php echo (I('param.key') == '2' && I('param.order') == '2') ? replaceParam(array('key' => '2', 'order'=>'1')) : replaceParam(array('key' => '2', 'order' => '2'));?>">价格</a></li>
        <li class='<?php echo I('param.key') == '3'?'selected':'';?>'><a <?php if(I('param.key') == '3'){?>class="<?php echo I('param.order') == 1 ? 'asc' : 'desc';?>"<?php }?> href="<?php echo (I('param.key') == '3' && I('param.order') == '2') ? replaceParam(array('key' => '3', 'order'=>'1')) : replaceParam(array('key' => '3', 'order' => '2'));?>">销量</a></li>
        <li class='<?php echo I('param.key') == '4'?'selected':'';?>'><a <?php if(I('param.key') == '4'){?>class="<?php echo I('param.order') == 1 ? 'asc' : 'desc';?>"<?php }?> href="<?php echo (I('param.key') == '4' && I('param.order') == '2') ? replaceParam(array('key' => '4', 'order'=>'1')) : replaceParam(array('key' => '4', 'order' => '2'));?>">收藏</a></li>
        <li class='<?php echo I('param.key') == '5'?'selected':'';?>'><a <?php if(I('param.key') == '5'){?>class="<?php echo I('param.order') == 1 ? 'asc' : 'desc';?>"<?php }?> href="<?php echo (I('param.key') == '5' && I('param.order') == '2') ? replaceParam(array('key' => '5', 'order'=>'1')) : replaceParam(array('key' => '5', 'order' => '2'));?>">人气</a></li>
      </ul> 
      <div class="ncs-search">
      <form id="" name="searchShop" method="get" action="{:url('shop/Showstore/goods_search')}" >
        <input type="hidden" name="store_id" value="<?php echo $store_info['store_id'];?>" />
        <input type="text" class="text w120" name="inkeyword" value="<?php echo I('param.inkeyword');?>" placeholder="搜索店内商品">
        <a href="javascript:document.searchShop.submit();" class="ncbtn">搜索</a>
      </form>
    </div>
    </div>
    <?php if(!empty($recommended_goods_list) && is_array($recommended_goods_list)){?>
    <div class="content ncs-all-goods-list mb15">
      <ul>
        <?php foreach($recommended_goods_list as $value){?>
        <li>
          <dl>
            <dt><a href="<?php echo url('shop/Goods/index',array('goods_id'=>$value['goods_id']));?>" class="goods-thumb" target="_blank"><img src="<?php echo UPLOAD_SITE_URL;?>/shop/common/loading.gif" rel="lazy" data-url="<?php echo thumb($value, 240);?>" alt="<?php echo $value['goods_name'];?>" /></a>
              <ul class="goods-thumb-scroll-show">
              <?php if (is_array($value['image'])) { array_splice($value['image'], 5);?>
                  <?php $i=0;foreach ($value['image'] as $val) { $i++; ?>
                  <li<?php if($i==1) {?> class="selected"<?php }?>><a href="javascript:void(0);">
                  	<img src="__UPLOAD_PATH__/shop/common/loading.gif" rel="lazy" data-url="<?php echo thumb($val, 60);?>"/></a></li>
                  <?php }?>
              <?php } else {?>
                  <li class="selected"><a href="javascript:void(0)">
                  	<img src="__UPLOAD_PATH__/shop/common/loading.gif" rel="lazy" data-url="<?php echo thumb($value, 60);?>"></a></li>
              <?php }?>
              </ul>
            </dt>
            <dd class="goods-name"><a href="<?php echo url('shop/Goods/index', array('goods_id'=>$value['goods_id']));?>" title="<?php echo $value['goods_name'];?>" target="_blank"><?php echo $value['goods_name']?></a></dd>
            <dd class="goods-info"><span class="price">￥<?php echo ncPriceFormat($value['goods_promotion_price']);?>
              </span><span class="goods-sold">售出：<strong><?php echo $value['goods_salenum'];?></strong> 件</span></dd>
            <?php if (sysconf('groupbuy_allow') && $value['goods_promotion_type'] == 1) {?>
            <dd class="goods-promotion"><span>抢购商品</span></dd>
            <?php } elseif (sysconf('promotion_allow') && $value['goods_promotion_type'] == 2)  {?>
            <dd class="goods-promotion"><span>限时折扣</span></dd>
            <?php }?>
          </dl>
        </li>
        <?php }?>
      </ul>
    </div>
    <div class="pagination"><?php echo $show_page; ?></div>
    <?php }else{?>
    <div class="content ncs-all-goods-list">
    <div class="nothing">
      <p>很抱歉! 没有找到相关商品</p>
    </div></div>
    <?php }?>
  </div>
</div>
<script>
$(function(){
    // 图片切换效果
    $('.goods-thumb-scroll-show').find('a').mouseover(function(){
        $(this).parents('li:first').addClass('selected').siblings().removeClass('selected');
        var _src = $(this).find('img').attr('src');
        _src = _src.replace('_60.', '_240.');
        _src = _src.replace('-60', '-240');
        $(this).parents('dt').find('.goods-thumb').find('img').attr('src', _src);
    });
});
</script>
{/block}
